<div id="information">
<br /><br />
<?php
$select_u = mysql_query('SELECT teacher_to FROM users WHERE username = "'.$_SESSION['username'].'"');
$row_u = mysql_fetch_assoc($select_u);

$select_m = mysql_query('SELECT * FROM termin WHERE module="'.$row_u['teacher_to'].'"');

if(mysql_num_rows($select_m)==0){
   echo '<p>Няма термини към този самоучител!</p>';
} else {

if($_GET['mode']=="edit"){
$select_module = mysql_query('SELECT * FROM termin WHERE dict_id='.$_GET['id'].'');
$row_module = mysql_fetch_assoc($select_module);
?>
<form method="post" action="<?php echo 'edittermin.php?id='.$_GET['id'].'&mode=edit'; ?>" class="form">
   <h3 class="form_h3">Термин</h3>
   <input type="text" name="term" value="<?php echo $row_module['term']; ?>" />
   <h3 class="form_h3">Описание</h3>
   <textarea cols="50" rows="5" name="descr"><?php echo $row_module['term_descr']; ?></textarea><br /><br />
   <select name="cat" >
	   <option value="А" <?php if($row_module['cat']=="A") {?> selected="selected" <?php } ?>>А</option>
	   <option value="Б" <?php if($row_module['cat']=="Б") {?> selected="selected" <?php } ?>>Б</option>
	   <option value="В" <?php if($row_module['cat']=="В") {?> selected="selected" <?php } ?>>В</option>
	   <option value="Г" <?php if($row_module['cat']=="Г") {?> selected="selected" <?php } ?>>Г</option>
	   <option value="Д" <?php if($row_module['cat']=="Д") {?> selected="selected" <?php } ?>>Д</option>
	   <option value="Е" <?php if($row_module['cat']=="Е") {?> selected="selected" <?php } ?>>Е</option>
	   <option value="Ж" <?php if($row_module['cat']=="Ж") {?> selected="selected" <?php } ?>>Ж</option>
	   <option value="З" <?php if($row_module['cat']=="З") {?> selected="selected" <?php } ?>>З</option>
	   <option value="И" <?php if($row_module['cat']=="И") {?> selected="selected" <?php } ?>>И</option>
	   <option value="Й" <?php if($row_module['cat']=="Й") {?> selected="selected" <?php } ?>>Й</option>
	   <option value="К" <?php if($row_module['cat']=="К") {?> selected="selected" <?php } ?>>К</option>
	   <option value="Л" <?php if($row_module['cat']=="Л") {?> selected="selected" <?php } ?>>Л</option>
	   <option value="М" <?php if($row_module['cat']=="М") {?> selected="selected" <?php } ?>>М</option>
	   <option value="Н" <?php if($row_module['cat']=="Н") {?> selected="selected" <?php } ?>>Н</option>
	   <option value="О" <?php if($row_module['cat']=="О") {?> selected="selected" <?php } ?>>О</option>
	   <option value="П" <?php if($row_module['cat']=="П") {?> selected="selected" <?php } ?>>П</option>
	   <option value="Р" <?php if($row_module['cat']=="Р") {?> selected="selected" <?php } ?>>Р</option>
	   <option value="С" <?php if($row_module['cat']=="С") {?> selected="selected" <?php } ?>>С</option>
	   <option value="Т" <?php if($row_module['cat']=="Т") {?> selected="selected" <?php } ?>>Т</option>
	   <option value="У" <?php if($row_module['cat']=="У") {?> selected="selected" <?php } ?>>У</option>
	   <option value="Ф" <?php if($row_module['cat']=="Ф") {?> selected="selected" <?php } ?>>Ф</option>
	   <option value="Х" <?php if($row_module['cat']=="Х") {?> selected="selected" <?php } ?>>Х</option>
	   <option value="Ц" <?php if($row_module['cat']=="Ц") {?> selected="selected" <?php } ?>>Ц</option>
	   <option value="Ч" <?php if($row_module['cat']=="Ч") {?> selected="selected" <?php } ?>>Ч</option>
	   <option value="Ш" <?php if($row_module['cat']=="Ш") {?> selected="selected" <?php } ?>>Ш</option>
	   <option value="Щ" <?php if($row_module['cat']=="Щ") {?> selected="selected" <?php } ?>>Щ</option>
	   <option value="Ю" <?php if($row_module['cat']=="Ю") {?> selected="selected" <?php } ?>>Ю</option>
	   <option value="Я" <?php if($row_module['cat']=="Я") {?> selected="selected" <?php } ?>>Я</option>
	</select>
   <br /><br />
   <input type="submit" name="submit_term" value="Редактирай термина" />
</form>
<?php
include "../php/edittermin.php";
} else if($_GET['mode']=="delete"){
   $delete_poll=mysql_query('DELETE FROM termin WHERE dict_id='.$_GET['id'].'');
   echo '<meta http-equiv="refresh" content="0; url=edittermin.php">';
} else {
   echo '
	<table border="0" style="border-collapse: collapse; margin-left: 20px; width: 650px; text-shadow: 1px 1px 1px #fff;">
	<tr style="background-color: #b7b6b6;"><td align="center"><p><b>Термина</b></p></td><td align="center"><p><b>Опции</b></p></td></tr>
	';
while($row_m = mysql_fetch_assoc($select_m)){
   	echo '<tr><td></td></tr>';
	echo '<tr><td></td></tr>';
	echo '<tr><td></td></tr>';
    echo '<tr style="height: 40px; background-color: #ede7e7; text-shadow: 3px 3px 3px #fff;"><td style="padding-left: 10px;"><b>'.$row_m['term'].'</b></td>
	<td style="padding-right: 10px; text-align: center;">
	<a href="edittermin.php?id='.$row_m['dict_id'].'&amp;mode=edit"><img src="../img/see.png" alt="see"/></a>
	<a href="edittermin.php?id='.$row_m['dict_id'].'&amp;mode=delete"><img src="../img/delete.png" alt="delete"/></a></td></tr>
	<tr><td colspan="4" style="padding-left: 10px; padding-right: 10px;"><hr /></td></tr>';
}
echo '</table>';
}
}
?>
</div>